package pojo.administrador;

import java.io.Serializable;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToOne;
import javax.persistence.Table;

@Entity
@Table(name = "tbs_usuario")
@NamedQueries({
    @NamedQuery(name = "Usuario.listAll", query = "SELECT u FROM Usuario u")
})
public class Usuario implements Serializable {

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "USU_ID")
    private long id;
    @Column(name = "USU_NOME", length = 45, nullable = false, unique = true)
    private String nome;
    @Column(name = "USU_LOGIN", length = 25, nullable = false, unique = true)
    private String login;
    @Column(name = "USU_SENHA", length = 50)
    private String senha;
    @OneToOne(cascade = CascadeType.ALL, mappedBy = "usuario")
    private Regra regra;

    public long getId() {
        return id;
    }

    public void setId(long id) {
        this.id = id;
    }

    public String getLogin() {
        return login;
    }

    public void setLogin(String login) {
        this.login = login;
    }

    public String getNome() {
        return nome;
    }

    public void setNome(String nome) {
        this.nome = nome;
    }

    public String getSenha() {
        return senha;
    }

    public void setSenha(String senha) {
        this.senha = senha;
    }

    public Regra getRegra() {
        return regra;
    }

    public void setRegra(Regra regra) {
        this.regra = regra;
    }
}
